package main

import (
	"fmt"
)

/* func main() {

	var animal Animaler

	c := Cat{}

	animal = c

	fmt.Println(animal.say())

	d := Dog{}
	animal = d

	fmt.Println(animal.say())

} */

func main() {

	var animal Animaler

	c := Cat{}

	animal = c

	fmt.Println(animal.say())

	d := &Dog{}
	animal = d

	fmt.Println(animal.say())

}

type Dog struct {
}

func (dog Dog) say() string {
	return "汪汪汪~"
}

func (dog Dog) move() {
	fmt.Println("狗狗在移动")
}

func (cat Cat) move() {
	fmt.Println("猫猫在移动")
}

type Cat struct {
}

func (cat Cat) say() string {
	return "喵喵喵~"
}

type Animaler interface {
	say() string
	move()
}
